s="ac"
def longestPalindrome(s):
    #先将字符串反转
    len_s=len(s)
    pointer_cur=len_s
    while pointer_cur>0:
        print("pointer_cur:",pointer_cur)
        l_pointer,r_pointer=0,pointer_cur-1
        while r_pointer<len_s:
            #利用滑动窗口取子字符串
            s_sub=s[l_pointer:r_pointer+1]
            if s_sub==s_sub[::-1]:
                return s_sub
            # print(s[l_pointer:r_pointer+1],s_re[l_pointer:r_pointer+1])
            # if s[l_pointer:r_pointer+1]==s_re[l_pointer:r_pointer+1]:
            #     表示找到了回文
            #     return s[l_pointer:r_pointer+1]
            else:
                #滑动窗口右移，
                l_pointer+=1
                r_pointer+=1
        #将滑动窗口值缩小，寻找短一点的回文
        pointer_cur-=1
print(longestPalindrome(s))